﻿using System;
using System.Collections.Generic;
using System.Data.Linq;
using System.Linq;
using System.Web.Mvc;
using VideoSeller.Business.Data;
using VideoSeller.Business.Data.Enums;

namespace VideoSeller.Web.Models
{
	public class ManageContentViewModel
	{
		private readonly List<string> _languages = new List<string>
			{
				"en-US",
				"fr-FR",
				"de-DE",
				"it-IT",
				"ru-RU",
				"es-ES",
				"zh-CN"
			};

		public Content Content { get; set; }

		public List<SelectListItem> Places { get; set; }

		public ManageContentViewModel()
		{
			Content = new Content
				{
					ContentPlace = new ContentPlace(),
					ContentLocalizations = new EntitySet<ContentLocalization>()
				};
			Content.ContentLocalizations.AddRange(_languages.Select(x => new ContentLocalization {CultureName = x}));
			Places = new List<SelectListItem>();
			foreach (var name in Enum.GetNames(typeof(ContentPlaceType)))
			{
				Places.Add(new SelectListItem { Text = name, Value = name });
			}
		}
	}
}